<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>登录 - 报销系统</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            height: 100vh;
            display: flex;
            align-items: center;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        }
        .login-container {
            width: 100%;
            max-width: 400px;
            margin: auto;
            padding: 2rem;
        }
        .card {
            border: none;
            border-radius: 15px;
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .card-body {
            padding: 2rem;
        }
        .form-floating {
            margin-bottom: 1rem;
        }
        .form-control:focus {
            box-shadow: none;
            border-color: #0d6efd;
        }
        .btn-login {
            width: 100%;
            padding: 0.8rem;
            font-size: 1rem;
            font-weight: 500;
            border-radius: 8px;
            margin-top: 1rem;
        }
        .system-title {
            text-align: center;
            color: #0d6efd;
            margin-bottom: 2rem;
            font-weight: 600;
        }
        .alert {
            border-radius: 8px;
            margin-bottom: 1.5rem;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="login-container">
            <div class="card">
                <div class="card-body">
                    <h2 class="system-title">报销审批系统</h2>
                    
                    <!-- 错误消息 -->
                    <div th:if="${error}" class="alert alert-danger" role="alert">
                        <i class="bi bi-exclamation-triangle-fill"></i>
                        <span th:text="${error}">用户名或密码错误</span>
                    </div>
                    
                    <!-- 登出消息 -->
                    <div th:if="${msg}" class="alert alert-success" role="alert">
                        <i class="bi bi-check-circle-fill"></i>
                        <span th:text="${msg}">您已成功退出系统</span>
                    </div>
                    
                    <!-- 会话过期消息 -->
                    <div th:if="${param.expired}" class="alert alert-warning" role="alert">
                        <i class="bi bi-exclamation-circle-fill"></i>
                        会话已过期，请重新登录
                    </div>
                    
                    <form th:action="@{/login}" method="post" class="needs-validation" novalidate>
                        <div class="form-floating">
                            <input type="text" class="form-control" id="username" name="username" 
                                   placeholder="用户名" required autofocus>
                            <label for="username">用户名</label>
                            <div class="invalid-feedback">
                                请输入用户名
                            </div>
                        </div>
                        
                        <div class="form-floating">
                            <input type="password" class="form-control" id="password" name="password" 
                                   placeholder="密码" required>
                            <label for="password">密码</label>
                            <div class="invalid-feedback">
                                请输入密码
                            </div>
                        </div>
                        
                        <button type="submit" class="btn btn-primary btn-login">
                            登录
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 表单验证
        (function () {
            'use strict'
            var forms = document.querySelectorAll('.needs-validation')
            Array.prototype.slice.call(forms).forEach(function (form) {
                form.addEventListener('submit', function (event) {
                    if (!form.checkValidity()) {
                        event.preventDefault()
                        event.stopPropagation()
                    }
                    form.classList.add('was-validated')
                }, false)
            })
        })()
    </script>
</body>
</html> 